<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include "../include/dbFunctions.php";
    include "../include/formFunctions.php";
    include "../include/menu.php";
    $id = $_SESSION['eid'];

//get data from event table
    $query1= "SELECT e.event_name, e.event_status, p.program_name, s.school_name, s.school_address, s.school_postal, e.event_class_level
                FROM event e,
                    school s,
                    program p,
                    contact_school c
            WHERE event_id = $id
            AND c.contact_school_id = e.contact_id
            AND c.school_id = s.school_id
            AND e.program_id = p.program_id";
    $event_array = executeSelectQuery($query1);
    $name = $event_array[0]['event_name'];
    $status = $event_array[0]['event_status'];
    $program = $event_array[0]['program_name'];
    $school = $event_array[0]['school_name'];
    $location = $event_array[0]['school_address'];
    $postal = $event_array[0]['school_postal'];
    $level = $event_array[0]['event_class_level'];
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>JA Scheduling</title>

        <script type="text/javascript" language="javascript" src="../media/js/jquery/jquery-1.6.1.min.js"></script>
        <script type="text/javascript" language="javascript" src="../media/js/jquery/jquery.validate.js"></script>
        <script type="text/javascript" language="javascript" src="../media/js/eventValidation.js"></script>

        <!-- Datepicker -->
        <link rel="stylesheet" type="text/css" href="../media/css/jquery-ui-1.8.13.custom.css" />
        <script type="text/javascript" src="../media/js/jquery/jquery-ui-1.8.13.custom.js"></script>
        <!--  CSS script -->
        <link rel="stylesheet" href="../media/css/screen.css" type="text/css" media="screen" title="default" />

        <script type="text/javascript" charset="utf-8">
            $(document).ready(function() {
                $("#eventform").validate(options_validate);
            });
        </script>
    </head>
    <body>
        <!-- DON'T TOUCH! Start: page-top-outer -->
            <?php
            top_outer();
            ?>
        <!-- End: page-top-outer -->

        <div class="clear">&nbsp;</div>

        <!--  start nav-outer-repeat................................................................................................. START -->
        <div class="nav-outer-repeat">
            <!--  start nav-outer -->
            <div class="nav-outer">

                <!-- start nav-right -->
                    <?php
                    nav_right();
                    ?>
                <!-- end nav-right -->


                <!--  start nav -->
                <div class="nav">
                    <div class="table">
                            <?php
                            navigation_event();
                            ?>
                        <div class="clear"></div>
                    </div>
                    <div class="clear"></div>
                </div>
                <!--  start nav -->

            </div>
            <div class="clear"></div>
            <!--  start nav-outer -->
        </div>
        <!--  start nav-outer-repeat................................................... END -->

        <div class="clear"></div>

        <!-- start content-outer ........................................................................................................................START -->
        <div id="content-outer">
            <!-- start content -->
            <div id="content">

                <!--  start page-heading --> <!--lyedit-->
                <div id="page-heading">
                    <h1>Edit Course General Information</h1>
                </div>
                <!-- end page-heading -->

                <table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
                    <tr>
                        <th rowspan="3" class="sized"><img src="../media/images/shared/side_shadowleft.jpg" width="20" height="300" alt="" /></th>
                        <th class="topleft"></th>
                        <td id="tbl-border-top">&nbsp;</td>
                        <th class="topright"></th>
                        <th rowspan="3" class="sized"><img src="../media/images/shared/side_shadowright.jpg" width="20" height="300" alt="" /></th>
                    </tr>
                    <tr>
                        <td id="tbl-border-left"></td>
                        <td>
                            <!--  start content-table-inner ...................................................................... START -->
                            <div id="content-table-inner">
                                <!--  start table-content  -->
                                <div id="table-content">
                                    <!--  Can put table start from here within this div--> <!--lyedit-->
                                    <em>* Required fields</em><br/>
                                    <form id ="eventform" action="action/eventDoUpdateGeneral.php" method="post">
                                        <table border="0" cellpadding="0" cellspacing="0"  id="id-form">
                                            <tr>
                                                <td colspan="2"><h3>General Information</h3></td>
                                            </tr>
                                            <tr>
                                                <th>Course Name<em>*</em></th>
                                                <input type="hidden" name ="id" value=<?php echo $id?>></input>
                                                <td><input class="inp-form" type="text" name ="name"  value="<?php echo $name?>"></td></input>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>Course Level<em>*</em></th>
                                                <td><input class="inp-form" type="text" name ="level"  value="<?php echo $level?>"></td></input>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>Course Status:<em>*</em></th>
                                                <td>
                                                    <select name="status" class="styledselect_form_1">
                                                            <?php
                                                            $default1= $status;
                                                            $valueArray= Array('requested','pending','confirmed');
                                                            $displayArray = Array('New','Confirmed','Finalized');
                                                            dynamicSelectForm($default1,$valueArray,$displayArray);
                                                            ?>
                                                    </select>
                                                </td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>Program Name:</th>
                                                <td><?php echo ucfirst($program);?></td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>School Name:</th>
                                                <td><?php echo ucfirst($school);?></td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>School Address:</th>
                                                <td><?php echo ucfirst($location);?></td>
                                                <td></td>
                                            </tr>
                                            <tr>
                                                <th>School Postal Code:</th>
                                                <td><?php echo ucfirst($postal);?></td>
                                                <td></td>
                                            </tr>
                                        </table>
                                        <input type="button" class="form-back" value="" onClick="javascript:history.go(-1)">
                                        <input type="submit" class="form-save" value=""/>
                                        <input type="reset" value="" class="form-reset"  />
                                    </form>
                                    <!--  end table-content here -->
                                </div>
                                <div class="clear"></div>
                            </div>
                            <!--  end content-table-inner ............................................END  -->
                        </td>
                        <td id="tbl-border-right"></td>
                    </tr>
                    <tr>
                        <th class="sized bottomleft"></th>
                        <td id="tbl-border-bottom">&nbsp;</td>
                        <th class="sized bottomright"></th>
                    </tr>
                </table>
                <div class="clear">&nbsp;</div>

            </div>
            <!--  end content -->
            <div class="clear">&nbsp;</div>
        </div>
        <!--  end content-outer........................................................END -->
            <?php
            footer();
            ?>

    </body>
</html>
    <?php
}else {
    header("Location: ../include/login.html");
}
?>